]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
status/location: Track enabled state
authorFlorian Müllner <fmuellner@gnome.org>
Wed, 9 Feb 2022 19:23:30 +0000 (20:23 +0100)
committerMarge Bot <marge-bot@gnome.org>
Thu, 10 Feb 2022 13:19:57 +0000 (13:19 +0000)
More fallout from commit e3a1d84992: We are tracking the agent's
:max-accuracy-level property that we don't use, but not :enabled.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5043

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2170>

js/ui/status/location.js

index 547c8347ad5cda738e1d3b90aa437c81f80952fd..f4b425c0225c5a5d6b12fa4a03c45802e847bc99 100644 (file)
@@ -238,8 +238,10 @@ class Indicator extends PanelMenu.SystemIndicator {
 
         this.menu.addMenuItem(this._item);
 
-        this._inUseId = this._agent.connect('notify::in-use', this._updateMenuLabels.bind(this));
-        this._maxAccuracyId = this._agent.connect('notify::max-accuracy-level', this._updateMenuLabels.bind(this));
+        this._agentSignals = [
+            this._agent.connect('notify::enabled', () => this._sync()),
+            this._agent.connect('notify::in-use', () => this._sync()),
+        ];
 
         this.connect('destroy', this._onDestroy.bind(this));
 
@@ -248,8 +250,8 @@ class Indicator extends PanelMenu.SystemIndicator {
     }
 
     _onDestroy() {
-        this._agent.disconnect(this._inUseId);
-        this._agent.disconnect(this._maxAccuracyId);
+        this._agentSignals.forEach(id => this._agent.disconnect(id));
+        this._agentSignals = [];
     }
 
     _onSessionUpdated() {
@@ -257,7 +259,7 @@ class Indicator extends PanelMenu.SystemIndicator {
         this.menu.setSensitive(sensitive);
     }
 
-    _updateMenuLabels() {
+    _sync() {
         if (this._agent.enabled) {
             this._item.label.text = this._indicator.visible
                 ? _('Location In Use')